/*
 * @Description:
 * @Author: xinqiao lxq1990.0716@qq.com
 * @Date: 2023-07-12
 * @LastEditors: xinqiao lxq1990.0716@qq.com
 * @LastEditTime: 2023-07-13
 */
import { defineComponent } from 'vue'
import type { RouteRecordRaw } from 'vue-router'

export type Component<T = any> = ReturnType<typeof defineComponent> | (() => Promise<typeof import('*.vue')>) | (() => Promise<T>)

// @ts-ignore
export interface AppRouteRecordRaw extends Omit<RouteRecordRaw, 'meta'> {
  name: string
  meta: Meta
  component?: Component | string
  components?: Component
  children?: AppRouteRecordRaw[]
  props?: Recordable
  fullPath?: string
}

export interface Meta {
  /** 全路径 */
  fullPath?: string
  /** 标题 */
  title?: string
  /** 图标 */
  icon?: Component
  /** 排序 */
  sortNo?: number
  /** 是否有菜单 */
  hasMenu?: boolean
  /** 是否显示面包屑 */
  breadcrumb?: boolean
}

export interface Menu extends Meta {
  /** 子菜单 */
  children?: Menu[]
}

export type AppRouteModule = AppRouteRecordRaw
